/*示例 10-20：一个 longest 函数的实现，它返回两个字符串 slice 中较长者，现在还不能编译 */
fn main() {
    let s1 = String::from("Hello, worlddddddddddd!");

    let result;
    {
        let s2 = String::from("abc");
        result = longest(s1, s2);
    }
    println!("最长的串：{}", result);
}

fn longest(s1: String, s2: String) -> String {
    if s1.len() > s2.len() {
        s1
    } else {
        s2
    }
}
